package com.zt.enums;

/**
 * 优惠券状态枚举
 */
public enum CouponStatus {
    INACTIVE(0, "未激活"),
    ACTIVE(1, "已激活"),
    EXPIRED(2, "已过期"),
    USED_UP(3, "已用完");

    private final Integer code;
    private final String description;

    CouponStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static CouponStatus fromCode(Integer code) {
        for (CouponStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }
}
